package com_djm_2025_06_05.demo3;

/**尽量不要在构造方法内调用被重写的方法
 *
 * @author dengjiangming
 * @date 2025-06-06
 * @version 1.0.0
 */
class B {
    public B() {
        func();
    }

    public void func() {
        System.out.println("B::func()...");
    }
}

class D extends B {
    private int num = 1;

    @Override
    public void func() {
        System.out.println("D.func()"+" "+num);
    }
}

public class Test {
    public static void main(String[] args) {
        D d = new D();
    }
}
